home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7795 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.2 KB

  1. Path: paperboy.wellfleet.com!newsmaster
  2. From: psmith@lemming.wellfleet.com (Paul D. Smith)
  3. Newsgroups: comp.unix.programmer,comp.lang.c
  4. Subject: Re: Runtime ANSI C checking tool?
  5. Date: 28 Feb 1996 19:14:53 -0500
  6. Organization: Bay Networks, Inc., Billerica, MA
  7. Message-ID: <p5ag239ede.fsf@lemming.wellfleet.com>
  8. References: <DnI89B.EnH@pgh.nauticom.net>
  9. Reply-To: psmith@wellfleet.com
  10. NNTP-Posting-Host: lemming.wellfleet.com
  11. In-reply-to: tybergm@pgh.nauticom.net's message of Wed, 28 Feb 1996 21:12:47
  12.     GMT
  13. To: tybergm@pgh.nauticom.net (Mark E. Tyberg)
  14. X-Newsreader: Gnus v5.1
  15.  
  16. %% Regarding Runtime ANSI C checking tool?;
  17. %% tybergm@pgh.nauticom.net (Mark E. Tyberg) writes:
  18.  
  19.     met> Does anyone know of a program (for UNIX) that can do _runtime_
  20.     met> checking for ANSI C violations/undefined behavior?
  21.  
  22. Well, a well-written ANSI C compiler should handle all language
  23. violations, and a well-written ANSI C system library should catch all
  24. runtime violations (passing NULL to strcpy() or something, for
  25. example).
  26.  
  27. Some vendors try to be cute and allow you to pass invalid args to
  28. standard functions without complaint by catching them and ignoring them
  29. (SunOS in particular does this a lot--not that SunOS's libc is ANSI by
  30. any stretch of the imagination :), but I say they should catch them and
  31. call abort() immediately!  They're not doing you any favors by making it
  32. that much more difficult to find your bug.  Dump core up front!  Make it
  33. easy to find the problem!
  34.  
  35. Unfortunately I'm not aware of a good ANSI C library that does all this:
  36. does GNU's libc do it?  That might be an option, for testing purposes.
  37.  
  38. Or did you have something else in mind?
  39. -- 
  40. -------------------------------------------------------------------------------
  41.  Paul D. Smith <psmith@baynetworks.com>         Network Management Development
  42.  Senior Software Engineer                                   Bay Networks, Inc.
  43. -----------------------------------------------==<http://www.baynetworks.com/>-
  44.  "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
  45. -------------------------------------------------------------------------------
  46.      These are my opinions--Bay Networks takes no responsibility for them.
  47.